﻿<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    
    <Style x:Key="ButtonFocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Rectangle SnapsToDevicePixels="true" Stroke="Black" StrokeDashArray="1 2" StrokeThickness="1" Margin="2"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <LinearGradientBrush x:Key="NormalBackground" EndPoint="0,1" StartPoint="0,0">
        <GradientStop Color="#727272" Offset="0"/>
        <GradientStop Color="#4c4c4c" Offset="1"/>
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="OverBackground" EndPoint="0,1" StartPoint="0,0">
        <GradientStop Color="#da5e69" Offset="0"/>
        <GradientStop Color="#d12e27" Offset="1"/>
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="ClickBackground" EndPoint="0,1" StartPoint="0,0">
        <GradientStop Color="#d22828" Offset="1"/>
        <GradientStop Color="#b00000" Offset="0"/>
    </LinearGradientBrush>

    <SolidColorBrush x:Key="NormalOuterBorder" Color="#7a7a7a"/>
    <SolidColorBrush x:Key="NormalInnerBorder" Color="#454545"/>

    <LinearGradientBrush x:Key="GlassBrush" EndPoint="0,1" StartPoint="0,0">
        <GradientStop Color="#96FFFFFF" Offset="0"/>
        <GradientStop Color="#28FFFFFF" Offset="0.5"/>
        <GradientStop Color="#00FFFFFF" Offset="0.5"/>
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="DisabledBackground" EndPoint="0,1" StartPoint="0,0">
        <GradientStop Color="#f4f4f4" Offset="0"/>
        <GradientStop Color="#d7d7d7" Offset="0.7"/>
        <GradientStop Color="#c2c2c2" Offset="1"/>
    </LinearGradientBrush>

    <SolidColorBrush x:Key="OuterBorderDisabled" Color="#cfcfcf"/>
    <SolidColorBrush x:Key="InnerBorderDisabled" Color="#b8b8b8"/>

    <Style TargetType="{x:Type Button}">
        <Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
        <Setter Property="Background" Value="{StaticResource NormalBackground}"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Padding" Value="1"/>
        <Setter Property="Margin" Value="5"/>
        <Setter Property="Height" Value="23"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Grid>
                        <Border x:Name="OuterBd" CornerRadius="3" BorderBrush="{StaticResource NormalOuterBorder}" BorderThickness="1" Background="{StaticResource NormalBackground}">
                            <Border x:Name="InnerBd" CornerRadius="2" BorderBrush="{StaticResource NormalInnerBorder}" BorderThickness="1">
                                <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True"/>
                            </Border>
                        </Border>
                        <Border x:Name="Glass" Margin="2" Background="{StaticResource GlassBrush}" CornerRadius="2"/>

                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter TargetName="OuterBd" Property="Background" Value="{StaticResource OverBackground}"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="true">
                            <Setter TargetName="OuterBd" Property="Background" Value="{StaticResource ClickBackground}"/>
                        </Trigger>
                        <Trigger Property="IsKeyboardFocused" Value="true">
                            <Setter TargetName="InnerBd" Property="BorderBrush" Value="#d12e27"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter TargetName="InnerBd" Property="BorderBrush" Value="{StaticResource InnerBorderDisabled}"/>
                            <Setter TargetName="OuterBd" Property="BorderBrush" Value="{StaticResource OuterBorderDisabled}"/>
                            <Setter TargetName="OuterBd" Property="Background" Value="{StaticResource DisabledBackground}"/>
                            <Setter Property="Foreground" Value="{StaticResource InnerBorderDisabled}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

 
    <!--========== Combo box ===========-->
    <Style x:Key="ItemStyle" TargetType="ContentControl">
        <Setter Property="Background" >
            <Setter.Value>
                <LinearGradientBrush EndPoint="0,1">
                    <GradientStop Color="#FFFFFFFF" Offset="0" />
                    <GradientStop Color="{DynamicResource {x:Static SystemColors.HighlightColorKey}}" Offset="1" />
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
        <Setter Property="BorderBrush" Value="#FF808080" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="DockPanel.Dock" Value="Top" />
        <Setter Property="Margin" Value="0,1,0,1" />
        <!--Setter Property="TextBox.TextAlignment" Value="Center" /-->
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ContentControl">
                    <Grid>
                        <Rectangle Name="SelectedHighlight"
                     Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}"
                     RadiusX="2" RadiusY="2" Opacity="0" />
                        <Rectangle Name="HighlightCanvas"
                     Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}"
                     RadiusX="2" RadiusY="2" Opacity="0" />
                        <ContentPresenter Margin="4,3,4,3" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="Selector.IsSelected" Value="True">
                            <Setter Property="Opacity" TargetName="SelectedHighlight" Value="1" />
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation From="0" To="1" Duration="0:0:0.15" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="HighlightCanvas" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation From="1" To="0" Duration="0:0:0.15" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="HighlightCanvas" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.ExitActions>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="ComboBox">
        <Setter Property="Background" Value="#FFFFFFFF" />
        <Setter Property="BorderBrush" Value="#FF808080" />
        <Setter Property="Padding" Value="10,0,0,0" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ComboBox">
                    <Grid Name="MainGrid">
                        <Popup Name="PART_Popup" AllowsTransparency="true" Placement="Bottom"
              IsOpen="{Binding Path=IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}"
              PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}">
                            <Grid Name="PopupCanvas" ClipToBounds="True" MaxHeight="{TemplateBinding MaxDropDownHeight}"
                      MinWidth="{Binding ElementName=MainGrid, Path=ActualWidth}">
                                <Rectangle Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" Margin="0,-1,0,0" />
                                <ScrollViewer CanContentScroll="true">
                                    <ItemsPresenter Margin="5" KeyboardNavigation.TabNavigation="Cycle" KeyboardNavigation.DirectionalNavigation="Cycle" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Grid.IsSharedSizeScope="true" />
                                </ScrollViewer>
                            </Grid>
                        </Popup>
                        <Rectangle Name="Background"
                     Stroke="Transparent" Fill="{TemplateBinding Background}"
                     RadiusX="3" RadiusY="3" />
                        <ContentPresenter IsHitTestVisible="false" Margin="{TemplateBinding Padding}" Content="{TemplateBinding SelectionBoxItem}" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                        <Grid HorizontalAlignment="Right" Width="20">
                            <Rectangle Name="rectangleArrow" RadiusX="3" RadiusY="3" Fill="{TemplateBinding BorderBrush}" />
                            <Path Data="M0,0L3.5,4 7,0z" Fill="White" HorizontalAlignment="Center" VerticalAlignment="Center" />
                            <Border Width="5" VerticalAlignment="Top"
                    BorderThickness="1,0,0,0" BorderBrush="{TemplateBinding BorderBrush}" />
                        </Grid>
                        <Rectangle Width="20" HorizontalAlignment="Left" RadiusX="3" RadiusY="3">
                            <Rectangle.Fill>
                                <RadialGradientBrush Center="0,0.2" RadiusX="0.3" RadiusY="1" GradientOrigin="0,0.2" Opacity="1">
                                    <RadialGradientBrush.GradientStops>
                                        <GradientStop Color="#FF2B1C1C" Offset="0" />
                                        <GradientStop Color="#00835252" Offset="1" />
                                        <GradientStop Color="#614B3030" Offset="0.68" />
                                    </RadialGradientBrush.GradientStops>
                                </RadialGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                        <Rectangle Height="20" VerticalAlignment="Top" RadiusX="3" RadiusY="3">
                            <Rectangle.Fill>
                                <RadialGradientBrush Center="0.4,0" RadiusX="1.2" RadiusY="0.3" GradientOrigin="0.4,0" Opacity="0.9">
                                    <RadialGradientBrush.GradientStops>
                                        <GradientStop Color="#FFFFFFFF" Offset="0" />
                                        <GradientStop Color="#00FFFFFF" Offset="1" />
                                    </RadialGradientBrush.GradientStops>
                                </RadialGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                        <Rectangle HorizontalAlignment="Right" Width="20" RadiusX="3" RadiusY="3">
                            <Rectangle.Fill>
                                <RadialGradientBrush Center="1,0.65" RadiusX="0.3" RadiusY="0.7" GradientOrigin="1,0.65" Opacity="0.8">
                                    <RadialGradientBrush.GradientStops>
                                        <GradientStop Color="#44582929" Offset="0.267" />
                                        <GradientStop Color="#00FFFFFF" Offset="1" />
                                        <GradientStop Color="#415E3131" Offset="0.297" />
                                        <GradientStop Color="#38734C4C" Offset="0.39" />
                                        <GradientStop Color="#DE381F1F" Offset="0.564" />
                                        <GradientStop Color="#FF762A2A" Offset="0.715" />
                                    </RadialGradientBrush.GradientStops>
                                </RadialGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                        <Rectangle VerticalAlignment="Bottom" Height="20" RadiusX="3" RadiusY="3">
                            <Rectangle.Fill>
                                <RadialGradientBrush Center="0.55,1" RadiusX="0.95" RadiusY="0.3" GradientOrigin="0.55,1" Opacity="0.8">
                                    <RadialGradientBrush.GradientStops>
                                        <GradientStop Color="#44222222" Offset="0" />
                                        <GradientStop Color="#00FFFFFF" Offset="1" />
                                    </RadialGradientBrush.GradientStops>
                                </RadialGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                        <Rectangle RadiusX="3" RadiusY="3" Fill="#00FFFFFF"
                     Stroke="{TemplateBinding BorderBrush}"/>
                        <ToggleButton IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}">
                            <ToggleButton.Style>
                                <Style TargetType="ToggleButton">
                                    <Setter Property="Background" Value="#00FFFFFF" />
                                    <Setter Property="Template">
                                        <Setter.Value>
                                            <ControlTemplate TargetType="ToggleButton">
                                                <Rectangle Fill="Transparent" />
                                            </ControlTemplate>
                                        </Setter.Value>
                                    </Setter>
                                </Style>
                            </ToggleButton.Style>
                        </ToggleButton>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Opacity" TargetName="rectangleArrow" Value="0.65" />
                        </Trigger>
                        <Trigger Property="HasItems" Value="False">
                            <Setter Property="MinHeight" TargetName="PopupCanvas" Value="100" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="ComboBoxItem" BasedOn="{StaticResource ItemStyle}" />


    <!--=====================================-->
    
    
</ResourceDictionary>